<!DOCTYPE html>
<html>
<head>
    <title>callbackDemo</title>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body>
<a href="javascript:eat();">吃饭</a>

<a href="javascript:drink();">喝水</a>

<a href="javascript:eat(drink);">吃饭后去喝水</a>
<script type="text/javascript">

function eat(callBack) {
    console.log("我吃好饭啦,我要去喝水啦!");
    if(callBack) callBack();
}
function drink() {
    console.log("我喝水了!");
}
showNum(1,2231);

showNum(11,2321);

showNum(111111,4322);

showNum(111,23);

showNum(1111,123432);

function showNum(a, b){
    num = a+b;
    console.log(num);
}
</script>
</body>
</html>